import request from '/@/utils/request';

export function decorationApi() {
    return {
        view: (id: string) => {
            return request({
                url: `/management/decorate/view/${id}`,
                method: 'GET',
            });
        },

        viewTemplate: (id: string) => {
            return request({
                url: `/management/decorate/view/template/${id}`,
                method: 'GET',
            });
        },

        delete: (id: string) => {
            return request({
                url: `/management/decorate/delete/${id}`,
                method: 'DELETE',
            });
        },

        create: (data: object) => {
            return request({
                url: `/management/decorate/create`,
                method: 'POST',
                data,
            });
        },

        update: (data: object) => {
            return request({
                url: `/management/decorate/update`,
                method: 'PUT',
                data,
            });
        },

        createBaseComponents: (data: object) => {
            return request({
                url: `/management/decorate/create/base/components`,
                method: 'POST',
                data,
            });
        },

        createHomeComponents: (data: object) => {
            return request({
                url: `/management/decorate/create/home/components`,
                method: 'POST',
                data,
            });
        },

        createUserComponents: (data: object) => {
            return request({
                url: `/management/decorate/create/user/components`,
                method: 'POST',
                data,
            });
        },

        batchDelete: (data: object) => {
            return request({
                url: `/management/decorate/batch/delete`,
                method: 'POST',
                data,
            });
        },

        search: (data: object) => {
            return request({
                url: '/management/decorate/search',
                method: 'post',
                data,
            });
        },

        used: (id: string) => {
            return request({
                url: `/management/decorate/used/${id}`,
                method: 'GET',
            });
        },
        viewPreview: (id: string) => {
            return request({
                url: `/management/decorate/preview/${id}`,
                method: 'GET',
            })
        }

    };
}
